<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <div class="main clearfix">
            <div class="main-box left">
                <main-work ></main-work>
            </div>
        </div>
    </div>
    <template id="temp">
        <div class="main-work">
            <div class="main-work-top clearfix">
                <div class="selection-show" @click="showSelectListFunc">
                    <span>{{input}}</span>
                </div>
            </div>
            <main-work-list @setvalue="setvalue" :show="showSelectList"></main-work-list>
        </div>
    </template>
    <template id="late">
        <div>
            <ul class="main-work-bottom" v-show="show">
                <li v-for="list in list" @:click="selectList(list)">{{list}}</li>
            </ul>
        </div>
    </template>
    <script type="text/javaScript" charset="UTF-8" src="/JS文件/vue.js"></script>
    <script>
        Vue.component("main-work",{
            template:"#temp",
            data(){
                return{
                    input:"请选择课程",
                    showSelectList:false
                }
            },
            methods:{
                showSelectListFunc(){
                    this.showSelectList=true;
            },
            hideSelectListFunc(){
                this.showSelectList=false;
            },
            setvalue(list,show){
                this.input = list;
                this.showSelectList=!show;
            }
        }
        })
        Vue.component("main-work-list",{
            template:"#late",
            props:['show'],
            data(){
                return {
                    list:[
                        'HTML5',
                        'Node.js',
                        "javaScript",
                        'Vue',
                    ]
                }
            },
            methods:{
                selectList(list){
                    this.$emit('setvalue',list,this.show);
                }
            }
        })
        var app = new Vue({
            el:'#app',
            data:{

            }
        })
    </script>
</body>
</html>